#pragma once

#include <array>
#include <vulkan/vulkan.h>
#include <GLFW/glfw3.h>

#define GLM_FORCE_DEFAULT_ALIGNED_GENTYPES
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>

#include <chrono>

struct Vertex {
	glm::vec2 pos;
	glm::vec3 color;
	glm::vec2 texCoord;

	static VkVertexInputBindingDescription getBindingDescription() {
		VkVertexInputBindingDescription bindingDescription{};

		bindingDescription.binding = 0;
		bindingDescription.stride = sizeof(Vertex);
		bindingDescription.inputRate = VK_VERTEX_INPUT_RATE_VERTEX;

		return bindingDescription;
	}
	
	static std::array<VkVertexInputAttributeDescription, 3> getAttributeDescriptions() {
		std::array<VkVertexInputAttributeDescription, 3> descs{};

		descs[0].binding = 0;
		descs[0].location = 0;
		descs[0].format = VK_FORMAT_R32G32_SFLOAT;
		descs[0].offset = offsetof(Vertex, pos);
		
		descs[1].binding = 0;
		descs[1].location = 1;
		descs[1].format = VK_FORMAT_R32G32B32_SFLOAT;
		descs[1].offset = offsetof(Vertex, color);

		descs[2].binding = 0;
		descs[2].location = 2;
		descs[2].format = VK_FORMAT_R32G32_SFLOAT;
		descs[2].offset = offsetof(Vertex, texCoord);

		return descs;
	}
};

struct UniformBufferObject {
	glm::mat4 model;
	glm::mat4 view;
	glm::mat4 proj;
};


int lmain4();
#define ENTRY lmain4